<?php
/*
	微信会员卡激活
*/
defined('BY_JYA') or exit('error');
if($_SESSION['container']!='wechat' && $_SESSION['container']!='wxapp'){
	exi('微信环境下才能领取！','error');
}
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin();
$return=array();
$setting=uni_setting('wx_card_setting');
if($_RQ['op']=='main'){
	$wxcard_code=pdo_getcolumn('core_fans',array('wxgid'=>$_SESSION['wechat_id'],'openid'=>$_SESSION['openid']),'wxcard_code');
	$return['member']=model('core/member')->detail($_SESSION['uid'],array('credit1','credit2','mobile','groupid','avatar','nickname'));
	if($return['member']['groupid']){
			$return['member']['group']=pdo_getcolumn('core_member_groups',array('id'=>$return['member']['groupid'],'uniacid'=>$_SESSION['uniacid']),'title');
	}else{
			$return['member']['group']='普通会员';
	}
	$return['wxcard_code']=$wxcard_code;
	$setting=uni_setting('member_setting');
	$return['appid']=pdo_getcolumn('core_account_wxapp',array('id'=>$_SESSION['wxapp_id'],'uniacid'=>$_SESSION['uniacid']),'appid');
	exi($return);
}
if($_RQ['op']=='active'){
	exi('','','core/member.addwxcard/active/');
}